use strict;
use warnings;
use lib 'lib';
use Askgene::Database::Schema;

my ($db, $host, $user, $passwd ) = ( 'askgene', 'localhost', 'wallacer', '' );
my $dsn = "dbi:mysql:database=$db;host=$host";

my $schema = Askgene::Database::Schema->connect($dsn, $user, $passwd);
$schema->deploy({ add_drop_table => '1' });

$schema->populate('Project', [
   [qw/ name summary description /],
   ['my_first_project', 'blah blah blah', 'more blah blah'],
   ['chrinipellis_perniciosa', 'blah blah blah', 'more blah blah'],
   ['miriaculus_pertubelis', 'blah blah blah', 'more blah blah'],
   ['sacanetium_esprutacus', 'blah blah blah', 'more blah blah'],
   ['vladinarium_grotinum_esptritus', 'blah blah blah', 'more blah blah'],
   ['my_last_project', 'blah blah blah', 'more blah blah'],
]);

my $project = $schema->resultset('Project')->find('my_first_project');
my $project1 = $schema->resultset('Project')->find('chrinipellis_perniciosa');
my $lib = $project->create_related('libs', {
   name        => 'Experimental',
   summary     => 'blah blah blah',
   description => 'more blah blah blah',
});
$project->create_related('libs', {
   name        => 'Internal',
   summary     => 'blah blah blah',
   description => 'more blah blah blah',
});

my $entry = $schema->resultset('Entry')->create({
   plate => 'UE-BINT-001'
});
$entry->library($lib);
$entry->update;

$schema->resultset('Entry')->create({
   plate => 'UE-BINT-002'
});
$schema->resultset('Entry')->create({
   plate => 'UE-BINT-003'
});

$schema->storage->disconnect;
